<!--
  Generated template for the OrderPage page.

  See http://ionicframework.com/docs/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header>

  <ion-navbar>
    <ion-title>订 单 管 理</ion-title>
    <ion-buttons end>
        <button ion-button icon-only (click)="message()">
          <ion-icon name="ios-chatbubbles"></ion-icon>
        </button>
      </ion-buttons>
  </ion-navbar>

</ion-header>


<ion-content>
  <ion-toolbar no-border-top>
    <ion-segment mode='md' [(ngModel)]="orderStatus" (ngModelChange)="statusChange()">
      <ion-segment-button value="all">
        全 部
      </ion-segment-button>
      <ion-segment-button value="0">
        待付款
      </ion-segment-button>
      <ion-segment-button value="1">
        待发货
      </ion-segment-button>
      <ion-segment-button value="2">
        待收货
      </ion-segment-button>
      <ion-segment-button value="3">
        已收货
      </ion-segment-button>

    </ion-segment>
  </ion-toolbar>
  <div class="order_list" *ngIf="orderList">
    <div class="list_item" *ngFor="let order of orderList">
      <p>订单编号：{{order.order_no}}
        <span>{{order.status_name}}</span>
        <ion-icon *ngIf="order.order_status == 5 " class="delete" name="ios-trash" (click)="deleteOrderConfirm(order.order_id)"></ion-icon>
      </p>
      <ion-list>
        <ion-item *ngFor="let ele of order.order_item_list">
          <ion-label (click)='openDetail($event,order)'>
            <image tappable [src]="ele.picture.pic_cover_mid" alt=""></image>
            <div>
              <p class="name" tappable>{{ele.goods_name}}</p>
              <p class="type" *ngIf="ele.qiu">柱镜：{{ele.zhu}}  /  球镜：{{ele.qiu}}</p>
              <p class="type" *ngIf="ele.sku_name">规格：{{ele.sku_name}}</p>
              <p class="price">价格：¥ {{ele.price}}</p>
            </div>
            <div class="nums">
              数量：{{ele.num}}
            </div>
          </ion-label>
        </ion-item>
      </ion-list>
      <div class="price">
        共
        <span>{{order.goods_count}}</span> 件商品,合计
        <span> ¥{{order.pay_money}} </span>
        <i> (含运费)</i>
      </div>
      <div class="status" *ngIf="order.order_status == 0">
        <!-- <span tappable (click)="closeOrderConfirm(order.order_id)">关闭订单</span> -->
        <span tappable (click)="orderPay(order)">去 付 款</span>
      </div>
      <div class="status" *ngIf="order.order_status == 1 ">
        <span tappable (click)='openDetail($event,order)'>订单详情</span>
      </div>
      <div class="status" *ngIf="order.order_status == 2">
        <span tappable (click)='openDetail($event,order)'>查看物流</span>
      </div>
      <div class="status" *ngIf="order.order_status == 3">
        <!-- <span tappable (click)="closeOrderConfirm(order.order_id)">关闭订单</span> -->
        <span *ngIf="order.is_evaluate!=1" tappable (click)="evaluate(order)">去评价</span>
      </div>
      <div class="status" *ngIf="order.order_status == 5">
        <span tappable (click)="deleteOrderConfirm(order.order_id)">删除订单</span>
      </div>
      <div class="status" *ngIf="order.order_status == 4 ">
        <span tappable (click)="closeOrderConfirm(order.order_id)">关闭订单</span>
      </div>
      <div class="status" *ngIf="order.order_status == 99 ">
        <span tappable (click)="closeOrderConfirm(order.order_id)">关闭订单</span>
        <span tappable (click)="openDetail($event,order)">等待商家确定总价</span>
      </div>
    </div>
  </div>
  <p class="no_more" *ngIf="!canLoadMore && orderList.length!=0">没有数据啦~</p>
  <p class="no_more" *ngIf="!canLoadMore && orderList.length==0">亲，没有订单数据哦~</p>
  <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
    <ion-infinite-scroll-content></ion-infinite-scroll-content>
  </ion-infinite-scroll>
</ion-content>
